package ca.on.eho.qa.pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.*;

import ca.on.eho.qa.util.Constants;

/**
 * @author larissa.smirnova
 * 
 * Created on: Oct-17-2014
 * Change log:
 * 
 */

public class CSLabResultsPage extends Page {
	
	private static WebElement element = null;
	private static WebDriverWait wait = null;
	
	public final String	POWERED_BY_EHEALTH_ONTARIO = "Powered by eHealth Ontario";
	public final String	PATIENT_LAB_RESULT = "Patient Lab Results";
	public final String	ODB_CLAIMS_HISTORY = "ODB Claims History";

	public By by_poweredByEHealthOntarioPortlet = By.id("mouseoverTable_7_SETA8B1A0079F0IR98MIHL0044");
	public By by_poweredByEHealthOntarioImage = By.cssSelector("img[title='Powered by eHealth Ontario']");
	public By by_patientLabResultsPortlet = By.id("mouseoverTable_7_SETA8B1A0079F0IR98MIHL0046");
	public By by_odbClaimsHistoryPortlet = By.id("mouseoverTable_7_SETA8B1A0G9N10INMBD6P82081");
	
	public CSLabResultsPage(PageManager pages) {
		super(pages);
	}
	
	@FindBy(id = "mouseoverTable_7_SETA8B1A0079F0IR98MIHL0044")
	private WebElement poweredByEHealthOntarioPortlet;
	
	@FindBy(css = "img[title='Powered by eHealth Ontario']")
	private WebElement poweredByEHealthOntarioImage;
	
	@FindBy(id = "mouseoverTable_7_SETA8B1A0079F0IR98MIHL0046i")
	private WebElement patientLabResultsPortlet;
	
	@FindBy(id = "mouseoverTable_7_SETA8B1A0G9N10INMBD6P82081e")
	private WebElement odbClaimsHistoryPortlet;

	
	public WebElement poweredByEHealthOntarioPortlet(WebDriver driver) {
		wait = new WebDriverWait(driver, Constants.MEDIUM_WAIT);
		element = wait.until(ExpectedConditions.presenceOfElementLocated(by_poweredByEHealthOntarioPortlet));	
		return element;		
	}
	
	public WebElement poweredByEHealthOntarioImage(WebDriver driver) {
		wait = new WebDriverWait(driver, Constants.MEDIUM_WAIT);
		element = wait.until(ExpectedConditions.presenceOfElementLocated(by_poweredByEHealthOntarioImage));
		return element;		
	}
	

	public WebElement patientLabResultsPortlet(WebDriver driver) {
		wait = new WebDriverWait(driver, Constants.MEDIUM_WAIT);
		element = wait.until(ExpectedConditions.presenceOfElementLocated(by_patientLabResultsPortlet));
		return element;		
	}

	public WebElement odbClaimsHistoryPortlet(WebDriver driver) {
		wait = new WebDriverWait(driver, Constants.MEDIUM_WAIT);
		element = wait.until(ExpectedConditions.presenceOfElementLocated(by_odbClaimsHistoryPortlet));
		return element;		
	}

}
